Skip to content

Conversation

@frankmcsherry
Copy link
Member

This PR removes the ability to borrow owned data as a reference type. The borrowing makes a lot of sense when your types are T and &T, but less sense when they are a different type (and the requirement blocks some implementations).

Generally, going from owned to borrowed data can always be accomplished by moving the data into a container, and imo we should put pressure on this to encourage the use of containers, for a few reasons. The most important is that if we really need data to be hash partitioned and ordered correctly, it should be the same type doing that. Sorting by TOwn rather than TRef<'_> has the risk of introducing a footgun, and this is especially possible when the container makes a different call about the partitioning or order (e.g. a hash map orders by a hash of the key, and a btree by the key itself).

The PR uses some performance-defective patterns in parts of the code that are not live, e.g. darker corners of dogs^3, and the robin hood hash trace. Both of these should get fixed up before relying on them, but for the moment it should only be a performance caveat.

Notably, in reduce.rs we actually move from a Vec<(Key, Time)> to containers for each, though .. they still derive their order from owned types and the containers (and vector) are ephemeral. If we were to get interesting into a container form, we'd have resolved a bit of the ownership issues here (key ownership, at least).

@frankmcsherry frankmcsherry merged commit d15bf32 into TimelyDataflow:master Jul 16, 2025
5 checks passed
@frankmcsherry frankmcsherry deleted the remove_borrow_as branch July 16, 2025 18:09
@github-actions github-actions bot mentioned this pull request Jul 16, 2025
@github-actions github-actions bot mentioned this pull request Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant